home *** CD-ROM | disk | FTP | other *** search
- An Explanation Of HAM
-
- On the Amiga and most other computers, images are defined by pixels on
- a screen. In the simplest display, a pixel can either be on (visible) or
- off (invisible). This can be compared to an LCD display on a digital watch.
- Computers are the same way. However with color computers like the Amiga, a
- little more is involved. Bit-planes are used to define multi-colored
- pixels. A bit-plane is a memory area used to define the pixels of a screen
- display. It refers to the number of bits that are used to define a single
- pixel. For instance, let's use an example of a Lo-Res 320 x 200 screen
- where we have an area 320 pixels wide by 200 pixels high. Now, lets say we
- have a single bit-plane available to define the display. For each pixel on
- the screen we have a single bit (binary digit, which can only be 1 or 0)
- that controls whether the pixel is on or off. In this mode, we only have
- two available colors: the color used when a pixel is off and the color
- used when a pixel is on. This can be demonstrated with the following
- simulation of a 16 x 16 pixel screen:
-
- 0000000000000000
- 0011111111111100
- 0100000000000010
- 0101110000111010
- 0101010000101010
- 0101110000111010
- 0100000100000010
- 0100000100000010
- 0100000100000010
- 0100000110000010
- 0101000000001010
- 0100100000010010
- 0100011111100010
- 0100000000000010
- 0011111111111100
- 0000000000000000
-
- By using 0s to represent one color and 1s to represent another, you should
- be able to make out an image of a face. Therefore, each pixel of a 1
- bit-plane image can be described as 0 or 1, for 2 possible colors. Every
- additional bit-plane doubles the available number of colors. In a 2
- bit-plane image, each pixel can be defined as 00, 01, 10, or 11, for a
- total of 4 colors. Furthermore, 3 bit-planes provides the following
- possibilities: 000, 001, 010, 100, 101, 110, 111 or 011 for a total of 8
- colors. If you notice every bit plane is the equivalent of raising 2 to
- some power:
-
- 1 bit-plane = 2 to the power of 1 or 2^1 = 2 colors
- 2 bit-planes: 2^2 or 2 x 2 = 4 colors
- 3 bit-planes: 2^3 or 2 x 2 x 2 = 8 colors
- 4 bit-planes: 2^4 or 2 x 2 x 2 x 2 = 16 colors
- 5 bit-planes: 2^5 or 2 x 2 x 2 x 2 x 2 = 32 colors
-
- As you can see, the possible number of colors relates to your available
- choices of color when you load DeluxePaint.
-
- To define actual color values, the Amiga adjusts the intensities of Red,
- Green and Blue used to display a pixel. The Amiga's built-in Hardware is
- capable of controlling 16 levels each for Red, Green or Blue. That is,
- 16 levels of Red, 16 levels of Green and 16 levels of Blue, for a possible
- total of 16 x 16 x 16 = 4096 total color possibilities. Each display mode
- represents a certain number of colors OUT OF a possible 4096. So that a 5
- bit-plane display allows 32 OUT OF 4096 colors.
-
- So, 6 bit-planes should be 2^6 or 64 colors right? Well, on the Amiga
- this is where HAM (Hold And Modify) mode comes in. Instead of directly
- accessing 64 separate colors, different calculations are used. Actually,
- this HAM mode uses mathematical trickery to display 4096 colors - you don't
- have the same, direct access with a HAM palette as you would in a 32 color
- palette. Instead, certain colors affect what adjacent colors can be. This
- allows the possibility of 4096 different colors on screen at one time.
-
- NOTE: There is a 64 color display mode, called Extra-Halfbrite Mode, but
- this does not provide truly independent access to 64 separate colors.
- the extra 32 are actually half-intensities of the first 32.
-
- SEE -> `HBrite Mode`
-
- Here's a condensed technical description of HAM mode.
-
- Instead of using 6 bits to directly define 64 colors HAM mode does the
- following calculations:
-
- If the first 2 bits are "00", the remaining 4 bits (which give a range
- from 0 to 15 for a total of 16 possibilities) are used to look up the
- pixel's color in the color table. This gives 16 definite values from
- a possible 4096 colors available (which is why DPaint only cycles
- the first 16 colors in HAM mode; all other colors are calculated from
- the first 16) in the Color Palette. Each color has 4 bits or 16
- levels each of red, green, and blue information; thus, each color has
- a Red value from 0 to 15, a Green value from 0 to 15, and a Blue value
- from 0 to 15. Again, since each color is defined by a combination of
- RGB, there are 16 x 16 x 16, or 4096 possible colors.
-
- If the first 2 bits of a given pixel are "01", the pixel has the same
- color as the pixel to its immediate left, except that the last four
- bits can be used to replace the Red value of that pixel. If the first
- 2 bits are "10", the last four bits replace the green value, and if
- the first two bits are "11", the last four bits replace the blue
- value. This is why the term "Hold and Modify" is used; two of the
- three values used to define a pixel are held, while the other is
- modified.
-
- The effect of all this is that you can display all 4096 colors on the
- screen at one time, although you can't go from black (R0,G0,B0) to
- white (R15,G15,B15) in one pixel; it takes a total of three pixels to
- allow you to make that transition since you can only modify one of the
- RGB values for each pixel. The transition would take four pixels on
- the screen with the first pixel being R0,G0,B0; the second pixel being
- R15,G0,B0; the third pixel being R15,G15,B0; and the fourth pixel
- being R15,G15,B15 (white).
-
- This limitation can cause some unexpected results. Certain colored
- pixels placed next to others can modify or become modified by other
- pixels. This is due to the way HAM must modify certain colors as
- mentioned previously. The result can be color fringing along certain
- color borders or edges. DPaint uses special routines to minimize this
- problem, but sometimes color fringing is unavoidable.
-
- Remember, that the first 16 colors are directly defined colors and
- are not defined by the HAM process. This means that those 16 can be
- used anywhere on the screen and won't affect or be affected by other
- colors.
-
-